package Operation;

import book.Book;
import book.BookList;

import java.util.Scanner;

public class FindOperation implements IOperation{
    public void work(BookList bookList) {

        Scanner scanner = new Scanner(System.in);
        System.out.print("请输入要查找的书名：");
        String name = scanner.nextLine();
        int current = bookList.getUsedSize();
        for (int i = 0; i < current; i++) {
            Book book = bookList.getBook(i);
            if(book.getName().equals(name)) {
                System.out.println("找到了，书籍信息如下：");
                System.out.println(book);
                return;
            }
        }
        System.out.println("找不到该书籍");
    }
}
